﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Algorithms.CSharp;

namespace SimpleTree
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Enter a string: ");
            var text = Console.ReadLine();

            SuffixTree tree = new SuffixTree(text);
            tree.Create();
            while (true)
            {
                Console.WriteLine("Enter search string:");
                string line = Console.ReadLine();
                int start = -1;
                int end = -1;
                if (tree.TryFind(line, ref start, ref end))
                {
                    Console.WriteLine("Found: Start = {0}, End = {1}", start, end);
                }
                else
                {
                    Console.WriteLine("Not Found");
                }
            }
        }
    }
}
